80 research outputs found

    Semantics of Types for Database Objects

    Get PDF
    This paper proposes a framework of denotational semantics of database type systems and constructs a type system for complex database objects. Starting with an abstract analysis of the relational model, we develop a mathematical theory for the structures of domains of database objects. Based on this framework, we construct a concrete database type system and its semantic domain. The type system allows arbitrarily complex structures that can be constructed using labeled records, labeled variants, finite sets and recursion. On the semantic domain, in addition to standard operations on records, variants and sets, a join and a projection are available as polymorphically typed computable functions on arbitrarily complex objects. We then show that both the type system and the semantic domain can be uniformly integrated in an ML-like programming language. This leads us to develop a database programming language that supports rich data structures and powerful operations for databases while enjoying desirable features of modern type systems of programming languages including strong static type-checking, static type inference and ML polymorphism

    A Simple Semantics for ML Polymorphism

    Get PDF
    We give a framework for denotational semantics for the polymorphic core of the programming language ML. This framework requires no more semantic material than what is needed for modeling the simple type discipline. In our view, the terms of ML are pairs consisting of a raw (untyped) lambda term and a type-scheme that ML\u27s type inference system can derive for the raw term. We interpret type-schemes as sets of simple types. Then, given any model M of the simply typed lambda calculus, the meaning of an ML term will be a set of pairs, each consisting of a simple type τ and an element of M of type τ. Hence, there is no need to interpret all raw terms, as was done in Milner\u27s original semantic framework. In comparison to Mitchell and Harper\u27s analysis, we avoid having to provide a very large type universe in which generic type-schemes are interpreted. Also, we show how to give meaning to ML terms rather than to derivations in the ML type inference system (which can be several for the same term). We give an axiomatization for the equational theory that corresponds to our semantic framework and prove the analogs of the compeleteness theorems that Friedman proved for the simply typed lambda calculus. The framework can be extended to languages with constants, type constructors and recursive types (via regular trees). For the extended language, we prove a theorem that allows the transfer of certain full abstraction results from languages based on the typed lambda calculus to ML-like languages

    Data Structures and Data Types in Object-Oriented Databases

    Get PDF
    The possibility of finding a static type system for object-oriented programming languages was initiated by Cardelli [Car88, CW85] who showed that it is possible to express the polymorphic nature of functions such a

    Polymorphism and Inference in Database Programming

    Get PDF
    The polymorphic type system of ML can be extended in two ways to make it the appropriate basis of a database programming language. The first is an extension to the language of types that captures the polymorphic nature of field selection; the second is a technique that generalizes relational operators to arbitrary data structures. The combination provides a statically typed language in which relational databases may be cleanly represented as typed structures. As in ML types are inferred, which relieves the programmer of making the rather complicated type assertions that may be required to express the most general type of a program that involving field selection and generalized relational operators. These extensions may also be used to provide static polymorphic typechecking in object-oriented languages and databases. A problem that arises with object-oriented databases is the apparent need for dynamic typechecking when dealing with queries on heterogeneous collections of objects. An extension of the type system needed for generalized relational operations can also be used for manipulating collections of dynamically typed values in a statically typed language. A prototype language based on these ideas has been implemented. While it lacks a proper treatment of persistent data, it demonstrates that a wide variety of database structures can be cleanly represented in a polymorphic programming language

    Static Type Inference for Parametric Classes

    Get PDF
    Central features of object-oriented programming are method inheritance and data abstraction attained through hierarchical organization of classes. Recent studies show that method inheritance can be nicely supported by ML style type inference when extended to labeled records. This is based on the fact that a function that selects a field ƒ of a record can be given a polymorphic type that enables it to be applied to any record which contains a field ƒ. Several type systems also provide data abstraction through abstract type declarations. However, these two features have not yet been properly integrated in a statically checked polymorphic type system. This paper proposes a static type system that achieves this integration in an ML-like polymorphic language by adding a class construct that allows the programmer to build a hierarchy of classes connected by multiple inheritance declarations. Moreover, classes can be parameterized by types allowing generic definitions. The type correctness of class declarations is st atically checked by the type system. The type system also infers a principal scheme for any type correct program containing methods and objects defined in classes

    Polymorphism and Type Inference in Database Programming

    Get PDF
    The polymorphic type system of ML can be extended in two ways that make it appropriate as the basis of a database programming language. The first is an extension to the language of types that captures the polymorphic nature of field selection; the second is a technique that generalizes relational operators to arbitrary data structures. The combination provides a statically typed language in which relational databases may be cleanly represented as typed structures. As in ML types are inferred, which relieves the programmer of making the rather complicated type assertions that may be required to express the most general type of a program that involves field selection and generalized relational operators. It is also possible to use these ideas to implement various aspects of object-oriented databases. By implementing database objects as reference types and generating the appropriate views - sets of structures with identity - we can achieve a degree of static type checking for object-oriented databases. Moreover it is possible to exploit the type system to check the consistency of object-oriented classes (abstract data types with inheritance). A prototype language based on these ideas has been implemented. While it lacks some important practical features, it demonstrates that a wide variety of database structures can be cleanly represented in a polymorphic programming language

    Using Kinds to Represent Heterogeneous Collections in a Static Type System (Extended Abstract)

    Get PDF
    We consider the problem of representing heterogeneous collections of objects in a typed polymorphic programming language in such a way that common properties of members of a collection, such as having commonly named field with a common type can be expressed in the type system. The use of such collections is widespread in object-oriented and database programming and has so far been achieved in statically typed systems only through the use of a single dynamic type, which effectively hides all the structure of a value. In this paper we exploit a system of types and kinds (sets of types) to represent dynamic values with some known properties. The type system is shown to be sound and to have a complete type inference algorithm

    Database Programming in Machiavelli - A Polymorphic Language With Static Type Inference

    Get PDF
    Machiavelli is a polymorphically typed programming language in the spirit of ML, but supports a different type inferencing that makes its polymorphism somewhat more general than that of ML and appropriate for database applications. In particular, a function that selects a field f of a records is polymorphic in the sense that it can be applied to any record which contains a field f with the appropriate type. When combined with a set data type and database operations including join and projection, this provides a natural medium for relational database programming. Moreover, by implementing database objects as reference types and generating the appropriate views - sets of structures with identity - we can achieve a degree of static type checking for object-oriented databases

    A Calculus with Partially Dynamic Records for Typeful Manipulation of JSON Objects

    Get PDF
    This paper investigates language constructs for high-level and type-safe manipulation of JSON objects in a typed functional language. A major obstacle in representing JSON in a static type system is their heterogeneous nature: in most practical JSON APIs, a JSON array is a heterogeneous list consisting of, for example, objects having common fields and possibly some optional fields. This paper presents a typed calculus that reconciles static typing constraints and heterogeneous JSON arrays based on the idea of partially dynamic records originally proposed and sketched by Buneman and Ohori for complex database object manipulation. Partially dynamic records are dynamically typed records, but some parts of their structures are statically known. This feature enables us to represent JSON objects as typed data structures. The proposed calculus smoothly extends with ML-style pattern matching and record polymorphism. These results yield a typed functional language where the programmer can directly import JSON data as terms having static types, and can manipulate them with the full benefits of static polymorphic type-checking. The proposed calculus has been embodied in SML#, an extension of Standard ML with record polymorphism and other practically useful features. This paper also reports on the details of the implementation and demonstrates its feasibility through examples using actual Web APIs. The SML# version 3.1.0 compiler includes JSON support presented in this paper, and is available from Tohoku University as open-source software under a BSD-style license
    corecore